<%= form_for [refinery, :calendar_admin, @event] do |f| -%>
  <%= render '/refinery/admin/error_messages',
              :object => @event,
              :include_object_name => true %>


  <div class='field'>
    <%= f.label :title -%>
    <%= f.text_field :title, :class => 'larger widest'  -%>
  </div>

  <div class="field">
    <p>
      <%= f.check_box :featured %>
      <%= f.label :featured, :class => 'stripped' %>
    </p>
  </div>

  <div class='field'>
    <%= f.label :from -%>
    <%= f.text_field :from, :class => 'datetime_range'  -%>
  </div>

  <div class='field'>
    <%= f.label :to -%>
    <%= f.text_field :to, :class => 'datetime_range'  -%>
  </div>

  <div class='field'>
    <%= f.label :registration_link -%>
    <%= f.text_field :registration_link, :class => 'larger'  -%>
  </div>

  <div class='field'>
    <%= f.label :venue_id, 'Venue' %>
    <%= f.collection_select :venue_id, @venues, :id, :name, { :include_blank => 'None' }, :class => 'chzn-select', :'data-placeholder' => 'Search Venues', :style => 'width: 300px;' %>
  </div>

  <div class='field'>
    <%= f.label :excerpt -%>
    <%= f.text_area :excerpt, :size => '65x5'  -%>
  </div>

  <div class='field'>
    <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
      <ul id='page_parts'>
        <% [:description].each_with_index do |part, part_index| %>
          <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
            <%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/calendar/event", :default => part.to_s.titleize), "##{part}" %>
          </li>
        <% end %>
      </ul>
      <div id='page_part_editors'>
        <% [:description].each do |part| %>
          <div class='page_part' id='<%= part %>'>
            <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
          </div>
        <% end %>
      </div>
    </div>

  </div>

  <%= render '/refinery/admin/form_actions', :f => f,
             :continue_editing => false,
             :delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
             :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %>
<% end -%>
<% content_for :stylesheets do %>
  <%= stylesheet_link_tag 'chosen' %>
<% end %>

<% content_for :javascripts do %>
  <%= javascript_include_tag 'chosen.jquery.min' %>
  <script>
    $(document).ready(function(){
      page_options.init(false, '', '');

      $('#event_venue_id').chosen({
        no_results_text: "No results matched",
        allow_single_deselect: true
      });
    });
  </script>
<% end %>
